package com.webchat.ugc.event.listener;

import com.webchat.ugc.event.MallChatGeneralEvent;
import com.webchat.ugc.event.enums.GeneralEventTypeEnum;
import com.webchat.ugc.service.mall.im.MallChatAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;


@Component
public class MallChatGeneralEventListener implements ApplicationListener<MallChatGeneralEvent<?>> {


    @Autowired
    private MallChatAccountService mallChatAccountService;

    @Override
    public void onApplicationEvent(MallChatGeneralEvent<?> event) {

        GeneralEventTypeEnum eventType = event.getEventType();
        switch (eventType) {

            case SEND_MESSAGE -> {

                Object data = event.getEventData();
                // TODO
//              mallChatAccountService.add();
//              mallChatAccountService.update();
                break;
            }
        }

    }
}
